package com.yonyou.gmcc.gateway.web.interceptor;
import io.jsonwebtoken.Claims;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import com.yonyou.gmcc.gateway.web.entity.UserEntity;
import com.yonyou.gmcc.gateway.web.jwt.JwtHelper;
import com.yonyou.gmcc.gateway.web.jwt.Md5Utils;
import com.yonyou.gmcc.gateway.web.util.TokenCheck;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AuthCheckInterceptor implements HandlerInterceptor{

	private static Logger logger=Logger.getLogger(AuthCheckInterceptor.class);

	@Override
	public boolean preHandle(HttpServletRequest req,
			HttpServletResponse res, Object handler) throws Exception {
		String uri=req.getRequestURI();
		logger.info("------进入拦截器,uri="+uri);
        return TokenCheck.check(req, res);
	}

	@Override
	public void postHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
		
	}

	@Override
	public void afterCompletion(HttpServletRequest req,
			HttpServletResponse res, Object handler, Exception ex)
			throws Exception {
	}
}
